/*!
 * Shadowbox.js, version 3.0.3
 * http://shadowbox-js.com/
 *
 * Copyright 2007-2010, Michael J. I. Jackson
 * 2010-03-10 00:00:00 +0000
 */
(function(window, undefined) 
{
    var S={version:"3.0.3"};
    var ua=navigator.userAgent.toLowerCase();
    if(ua.indexOf("windows")>-1||ua.indexOf("win32")>-1)
    {
        S.isWindows=true
    }
    else
    {
        if(ua.indexOf("macintosh")>-1||ua.indexOf("mac os x")>-1)
        {
            S.isMac=true
        }
        else
        {
            if(ua.indexOf("linux")>-1)
            {
                S.isLinux=true
            }
        }
	}
	S.isIE=ua.indexOf("msie")>-1;
	S.isIE6=ua.indexOf("msie 6")>-1;
	S.isIE7=ua.indexOf("msie 7")>-1;
	S.isGecko=ua.indexOf("gecko")>-1&&ua.indexOf("safari")==-1;
	S.isWebKit=ua.indexOf("applewebkit/")>-1;
	var inlineId=/#(.+)$/,galleryName=/^(light|shadow)box\[(.*?)\]/i,inlineParam=/\s*([a-z_]*?)\s*=\s*(.+)\s*/,fileExtension=/[0-9a-z]+$/i,scriptPath=/(.+\/)shadowbox\.js/i;
	var open=false,initialized=false,lastOptions={},slideDelay=0,slideStart,slideTimer;
	S.current=-1;
	S.dimensions=null;
	S.ease=function(a)
	{
        return 1+Math.pow(a-1,3)
	};
	S.errorInfo=
	{
        fla:{name:"Flash",url:"http://www.adobe.com/products/flashplayer/"},
		qt:{name:"QuickTime",url:"http://www.apple.com/quicktime/download/"},
		wmp:{name:"Windows Media Player",url:"http://www.microsoft.com/windows/windowsmedia/"},
		f4m:{name:"Flip4Mac",url:"http://www.flip4mac.com/wmv_download.htm"}
	};
	S.gallery=[];
	S.onReady=noop;
	S.path='http://cameronpreston.com/wp/wp-content/plugins/shadowbox-js/shadowbox/';
	S.player=null;
	S.playerId="sb-player";
	S.options=
    {
        animate:true,
		animateFade:true,
		autoplayMovies:true,
		continuous:false,
		enableKeys:true,
		flashParams:{bgcolor:"#000000",allowfullscreen:true},
		flashVars:{},
		flashVersion:"9.0.115",
		handleOversize:"resize",
		handleUnsupported:"link",
		onChange:noop,
		onClose:noop,
		onFinish:noop,
		onOpen:noop,
		showMovieControls:true,
		skipSetup:false,
		slideshowDelay:0,
		viewportPadding:20
	};
	S.getCurrent=function()
    {
        return S.current>-1?S.gallery[S.current]:null
	};
	S.hasNext=function()
    {
        return S.gallery.length>1&&(S.current!=S.gallery.length-1||S.options.continuous)
	};
	S.isOpen=function()
    {
        return open
	};
	S.isPaused=function()
    {
        return slideTimer=="pause"
	};
	S.applyOptions=function(a)
    {
        lastOptions=apply({},S.options);
		apply(S.options,a)
	};
	S.revertOptions=function()
    {
        apply(S.options,lastOptions)
	};
	S.init=function(c,f)
    {
        if(initialized)
        {
        	return
		}
		initialized=true;
		if(S.skin.options)
        {
        	apply(S.options,S.skin.options)
		}
		if(c)
        {
        	apply(S.options,c)
		}
		if(!S.path)
        {
        	var e,b=document.getElementsByTagName("script");
			for(var d=0,a=b.length;d<a;++d)
        	{
        		e=scriptPath.exec(b[d].src);
				if(e)
        		{
        			S.path=e[1];
					break
				}
			}
		}
		if(f)
        {
        	S.onReady=f
		}
		bindLoad()
	};
	S.open=function(b)
    {
        if(open)
        {
        	return
		}
		var a=S.makeGallery(b);
		S.gallery=a[0];
		S.current=a[1];
		b=S.getCurrent();
		if(b==null)
        {
			return
		}
		S.applyOptions(b.options||{});
		filterGallery();
		if(S.gallery.length)
        {
        	b=S.getCurrent();
			if(S.options.onOpen(b)===false)
        	{
				return
			}
			open=true;
			S.skin.onOpen(b,load)
		}
	};
	S.close=function()
    {
        if(!open)
		{
			return
		}
		open=false;
		if(S.player)
		{
			S.player.remove();
			S.player=null
		}
		if(typeof slideTimer=="number")
		{
			clearTimeout(slideTimer);
			slideTimer=null
		}
		slideDelay=0;
		listenKeys(false);
		S.options.onClose(S.getCurrent());
		S.skin.onClose();
		S.revertOptions()
	};
	S.play=function()
	{
		if(!S.hasNext())
		{
			return
		}
		if(!slideDelay)
		{
			slideDelay=S.options.slideshowDelay*1000
		}
		if(slideDelay)
		{
			slideStart=now();
			slideTimer=setTimeout(function()
			{
				slideDelay=slideStart=0;
				S.next()
			},slideDelay);
			if(S.skin.onPlay)
			{
				S.skin.onPlay()
			}
		}
	};
	S.pause=function()
	{
		if(typeof slideTimer!="number")
		{
			return
		}
		slideDelay=Math.max(0,slideDelay-(now()-slideStart));
		if(slideDelay)
		{
			clearTimeout(slideTimer);
			slideTimer="pause";
			if(S.skin.onPause)
			{
				S.skin.onPause()
			}
		}
	};
	S.change=function(a)
	{
		if(!(a in S.gallery))
		{
			if(S.options.continuous)
			{
				a=(a<0?S.gallery.length+a:0);
				if(!(a in S.gallery))
				{
					return
				}
			}
			else
			{
				return
			}
		}
		S.current=a;
		if(typeof slideTimer=="number")
		{
			clearTimeout(slideTimer);
			slideTimer=null;
			slideDelay=slideStart=0
		}
		S.options.onChange(S.getCurrent());
		load(true)
	};
	S.next=function()
	{
		S.change(S.current+1)
	};
	S.previous=function()
	{
		S.change(S.current-1)
	};
	S.setDimensions=function(o,f,m,n,e,a,k,h)
	{
		var j=o,d=f;
		var i=2*k+e;
		if(o+i>m)
		{
			o=m-i
		}
		var c=2*k+a;
		if(f+c>n)
		{
			f=n-c
		}
		var b=(j-o)/j,l=(d-f)/d,g=(b>0||l>0);
		if(h&&g)
		{
			if(b>l)
			{
				f=Math.round((d/j)*o)
			}
			else
			{
				if(l>b)
				{
					o=Math.round((j/d)*f)
				}
			}
		}
		S.dimensions=
		{
			height:o+e,
			width:f+a,
			innerHeight:o,
			innerWidth:f,
			top:Math.floor((m-(o+i))/2+k),
			left:Math.floor((n-(f+c))/2+k),
			oversized:g
		};
		return S.dimensions
	};
	S.makeGallery=function(e)
	{
		var a=[],d=-1;
		if(typeof e=="string")
		{
			e=[e]
		}
		if(typeof e.length=="number")
		{
			each(e,function(g,h)
			{
				if(h.content)
				{
					a[g]=h
				}
				else
				{
					a[g]={content:h}
				}
			});
			d=0
		}
		else
		{
			if(e.tagName)
			{
				var b=S.getCache(e);
				e=b?b:S.makeObject(e)
			}
			if(e.gallery)
			{
				a=[];
				var f;
				for(var c in S.cache)
				{
					f=S.cache[c];
					if(f.gallery&&f.gallery==e.gallery)
					{
						if(d==-1&&f.content==e.content)
						{
							d=a.length
						}
						a.push(f)
					}
				}
				if(d==-1)
				{
					a.unshift(e);
					d=0
				}
			}
			else
			{
				a=[e];
				d=0
			}
		}
		each(a,function(g,h)
		{
			a[g]=apply({},h)
		});
		return[a,d]
	};
	S.makeObject=function(d,c)
	{
		var e=
		{
			content:d.href,
			title:d.getAttribute("title")||"",
			link:d
		};
		if(c)
		{
			c=apply({},c);
			each(["player","title","height","width","gallery"],function(f,g)
			{
				if(typeof c[g]!="undefined")
				{
					e[g]=c[g];
					delete c[g]
				}
			});
			e.options=c
		}
		else
		{
			e.options={}
		}
		if(!e.player)
		{
			e.player=S.getPlayer(e.content)
		}
		var a=d.getAttribute("rel");
		if(a)
		{
			var b=a.match(galleryName);
			if(b)
			{
				e.gallery=escape(b[2])
			}
			each(a.split(";"),function(f,g)
			{
				b=g.match(inlineParam);
				if(b)
				{
					e[b[1]]=b[2]
				}
			})
		}
		return e
	};
	S.getPlayer=function(c)
	{
		if(c.indexOf("#")>-1&&c.indexOf(document.location.href)==0)
		{
			return"inline"
		}
		var d=c.indexOf("?");
		if(d>-1)
		{
			c=c.substring(0,d)
		}
		var b,a=c.match(fileExtension);
		if(a)
		{
			b=a[0].toLowerCase()
		}
		if(b)
		{
			if(S.img&&S.img.ext.indexOf(b)>-1)
			{
				return"img"
			}
			if(S.swf&&S.swf.ext.indexOf(b)>-1)
			{
				return"swf"
			}
			if(S.flv&&S.flv.ext.indexOf(b)>-1)
			{
				return"flv"
			}
			if(S.qt&&S.qt.ext.indexOf(b)>-1)
			{
				if(S.wmp&&S.wmp.ext.indexOf(b)>-1)
				{
					return"qtwmp"
				}
				else
				{
					return"qt"
				}
			}
			if(S.wmp&&S.wmp.ext.indexOf(b)>-1)
			{
				return"wmp"
			}
		}
		return"iframe"
	};
	function filterGallery()
	{
		var d=S.errorInfo,e=S.plugins,g,h,l,c,k,b,j,a;
		for(var f=0;f<S.gallery.length;++f)
		{
			g=S.gallery[f];
			h=false;
			l=null;
			switch(g.player)
			{
				case"flv":
				case"swf":
					if(!e.fla)
					{
						l="fla"
					}
					break;
				case"qt":
					if(!e.qt)
					{
						l="qt"
					}
					break;
				case"wmp":
					if(S.isMac)
					{
						if(e.qt&&e.f4m)
						{
							g.player="qt"
						}
						else
						{
							l="qtf4m"
						}
					}
					else
					{
						if(!e.wmp)
						{
							l="wmp"
						}
					}
					break;
				case"qtwmp":
					if(e.qt)
					{
						g.player="qt"
					}
					else
					{
						if(e.wmp)
						{
							g.player="wmp"
						}
						else
						{
							l="qtwmp"
						}
					}
					break
			}
			if(l)
			{
				if(S.options.handleUnsupported=="link")
				{
					switch(l)
					{
						case"qtf4m":
							k="shared";
							b=[d.qt.url,d.qt.name,d.f4m.url,d.f4m.name];
							break;
						case"qtwmp":
							k="either";
							b=[d.qt.url,d.qt.name,d.wmp.url,d.wmp.name];
							break;
						default:
							k="single";
							b=[d[l].url,d[l].name]
					}
					g.player="html";
					g.content='<div class="sb-message">'+sprintf(S.lang.errors[k],b)+"</div>"
				}
				else
				{
					h=true
				}
			}
			else
			{
				if(g.player=="inline")
				{
					c=inlineId.exec(g.content);
					if(c)
					{
						j=get(c[1]);
						if(j)
						{
							g.content=j.innerHTML
						}
						else
						{
							h=true
						}
					}
					else
					{
						h=true
					}
				}
				else
				{
					if(g.player=="swf"||g.player=="flv")
					{
						a=(g.options&&g.options.flashVersion)||S.options.flashVersion;
						if(S.flash&&!S.flash.hasFlashPlayerVersion(a))
						{
							g.width=310;
							g.height=177
						}
					}
				}
			}
			if(h)
			{
				S.gallery.splice(f,1);
				if(f<S.current)
				{
					--S.current
				}
				else
				{
					if(f==S.current)
					{
						S.current=f>0?f-1:f
					}
				}
				--f
			}
		}
	}
	function listenKeys(a)
	{
		if(!S.options.enableKeys)
		{
			return
		}
		(a?addEvent:removeEvent)(document,"keydown",handleKey)
	}
	function handleKey(c)
	{
		if(c.metaKey||c.shiftKey||c.altKey||c.ctrlKey)
		{
			return
		}
		var b=keyCode(c),a;
		switch(b)
		{
			case 81:
			case 88:
			case 27:
				a=S.close;
				break;
			case 37:
				a=S.previous;
				break;
			case 39:
				a=S.next;
				break;
			case 32:
				a=typeof slideTimer=="number"?S.pause:S.play;
				break
		}
		if(a)
		{
			preventDefault(c);
			a()
		}
	}
	function load(i)
	{
		listenKeys(false);
		var h=S.getCurrent();
		var e=(h.player=="inline"?"html":h.player);
		if(typeof S[e]!="function")
		{
			throw"unknown player "+e
		}
		if(i)
		{
			S.player.remove();
			S.revertOptions();
			S.applyOptions(h.options||{})
		}
		S.player=new S[e](h,S.playerId);
		if(S.gallery.length>1)
		{
			var f=S.gallery[S.current+1]||S.gallery[0];
			if(f.player=="img")
			{
				var d=new Image();
				d.src=f.content
			}
			var g=S.gallery[S.current-1]||S.gallery[S.gallery.length-1];
			if(g.player=="img")
			{
				var c=new Image();
				c.src=g.content
			}
		}
		S.skin.onLoad(i,waitReady)
	}
	function waitReady()
	{
		if(!open)
		{
			return
		}
		if(typeof S.player.ready!="undefined")
		{
			var a=setInterval(function()
			{
				if(open)
				{
					if(S.player.ready)
					{
						clearInterval(a);
						a=null;
						S.skin.onReady(show)
					}
				}
				else
				{
					clearInterval(a);
					a=null
				}
			},10)
		}
		else
		{
			S.skin.onReady(show)
		}
	}
	function show()
	{
		if(!open)
		{
			return
		}
		S.player.append(S.skin.body,S.dimensions);
		S.skin.onShow(finish)
	}
	function finish()
	{
		if(!open)
		{
			return
		}
		if(S.player.onLoad)
		{
			S.player.onLoad()
		}
		S.options.onFinish(S.getCurrent());
		if(!S.isPaused())
		{
			S.play()
		}
		listenKeys(true)
	};
	if(!Array.prototype.indexOf)
	{
		Array.prototype.indexOf=function(b,c)
		{
			var a=this.length>>>0;
			c=c||0;
			if(c<0)
			{
				c+=a
			}
			for(;c<a;++c)
			{
				if(c in this&&this[c]===b)
				{
					return c
				}
			}
			return -1
		}
	}
	function now()
	{
		return(new Date).getTime()
	}
	function apply(a,c)
	{
		for(var b in c)
		{
			a[b]=c[b]
		}
		return a
	}
	function each(d,e)
	{
		var b=0,a=d.length;
		for(var c=d[0];b<a&&e.call(c,b,c)!==false;c=d[++b])
		{}
	}
	function sprintf(b,a)
	{
		return b.replace(/\{(\w+?)\}/g,function(c,d){return a[d]})
	}
	function noop()
	{
	}
	function get(a)
	{
		return document.getElementById(a)
	}
	function remove(a)
	{
		a.parentNode.removeChild(a)
	}
	var supportsOpacity=true,supportsFixed=true;
	function checkSupport()
	{
		var a=document.body,b=document.createElement("div");
		supportsOpacity=typeof b.style.opacity==="string";
		b.style.position="fixed";
		b.style.margin=0;
		b.style.top="20px";
		a.appendChild(b,a.firstChild);
		supportsFixed=b.offsetTop==20;
		a.removeChild(b)
	}
	S.getStyle=(function()
	{
		var a=/opacity=([^)]*)/,b=document.defaultView&&document.defaultView.getComputedStyle;
		return function(f,e)
		{
			var d;
			if(!supportsOpacity&&e=="opacity"&&f.currentStyle)
			{
				d=a.test(f.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";
				return d===""?"1":d
			}
			if(b)
			{
				var c=b(f,null);
				if(c)
				{
					d=c[e]
				}
				if(e=="opacity"&&d=="")
				{
					d="1"
				}
			}
			else
			{
				d=f.currentStyle[e]
			}
			return d
		}
	})();
	S.appendHTML=function(c,b)
	{
		if(c.insertAdjacentHTML)
		{
			c.insertAdjacentHTML("BeforeEnd",b)
		}
		else
		{
			if(c.lastChild)
			{
				var a=c.ownerDocument.createRange();
				a.setStartAfter(c.lastChild);
				var d=a.createContextualFragment(b);
				c.appendChild(d)
			}
			else
			{
				c.innerHTML=b
			}
		}
	};
	S.getWindowSize=function(a)
	{
		if(document.compatMode==="CSS1Compat")
		{
			return document.documentElement["client"+a]
		}
		return document.body["client"+a]
	};
	S.setOpacity=function(c,a)
	{
		var b=c.style;
		if(supportsOpacity)
		{
			b.opacity=(a==1?"":a)
		}
		else
		{
			b.zoom=1;
			if(a==1)
			{
				if(typeof b.filter=="string"&&(/alpha/i).test(b.filter))
				{
					b.filter=b.filter.replace(/\s*[\w\.]*alpha\([^\)]*\);?/gi,"")
				}
			}
			else
			{
				b.filter=(b.filter||"").replace(/\s*[\w\.]*alpha\([^\)]*\)/gi,"")+" alpha(opacity="+(a*100)+")"
			}
		}
	};
	S.clearOpacity=function(a)
	{
		S.setOpacity(a,1)
	};
	function getTarget(b)
	{
		var a=b.target?b.target:b.srcElement;
		return a.nodeType==3?a.parentNode:a
	}
	function getPageXY(b)
	{
		var a=b.pageX||(b.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),c=b.pageY||(b.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
		return[a,c]
	}
	function preventDefault(a)
	{
		a.preventDefault()
	}
	function keyCode(a)
	{
		return a.which?a.which:a.keyCode
	}
	function addEvent(d,c,b)
	{
		if(d.addEventListener)
		{
			d.addEventListener(c,b,false)
		}
		else
		{
			if(d.nodeType===3||d.nodeType===8)
			{
				return
			}
			if(d.setInterval&&(d!==window&&!d.frameElement))
			{
				d=window
			}
			if(!b.__guid)
			{
				b.__guid=addEvent.guid++
			}
			if(!d.events)
			{
				d.events={}
			}
			var a=d.events[c];
			if(!a)
			{
				a=d.events[c]={};
				if(d["on"+c])
				{
					a[0]=d["on"+c]
				}
			}
			a[b.__guid]=b;
			d["on"+c]=addEvent.handleEvent
		}
	}
	addEvent.guid=1;
	addEvent.handleEvent=function(d)
	{
		var a=true;
		d=d||addEvent.fixEvent(((this.ownerDocument||this.document||this).parentWindow||window).event);
		var b=this.events[d.type];
		for(var c in b)
		{
			this.__handleEvent=b[c];
			if(this.__handleEvent(d)===false)
			{
				a=false
			}
		}
		return a
	};
	addEvent.preventDefault=function()
	{
		this.returnValue=false
	};
	addEvent.stopPropagation=function()
	{
		this.cancelBubble=true
	};
	addEvent.fixEvent=function(a)
	{
		a.preventDefault=addEvent.preventDefault;
		a.stopPropagation=addEvent.stopPropagation;
		return a
	};
	function removeEvent(c,b,a)
	{
		if(c.removeEventListener)
		{
			c.removeEventListener(b,a,false)
		}
		else
		{
			if(c.events&&c.events[b])
			{
				delete c.events[b][a.__guid]
			}
		}
	};
	var loaded=false,DOMContentLoaded;
	if(document.addEventListener)
	{
		DOMContentLoaded=function()
		{
			document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);
			S.load()
		}
	}
	else
	{
		if(document.attachEvent)
		{
			DOMContentLoaded=function()
			{
				if(document.readyState==="complete")
				{
					document.detachEvent("onreadystatechange",DOMContentLoaded);
					S.load()
				}
			}
		}
	}
	function doScrollCheck()
	{
		if(loaded)
		{
			return
		}
		try
		{
			document.documentElement.doScroll("left")
		}
		catch(a)
		{
			setTimeout(doScrollCheck,1);
			return
		}
		S.load()
	}
	function bindLoad()
	{
		if(document.readyState==="complete")
		{
			return S.load()
		}
		if(document.addEventListener)
		{
			document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);
			window.addEventListener("load",S.load,false)
		}
		else
		{
			if(document.attachEvent)
			{
				document.attachEvent("onreadystatechange",DOMContentLoaded);
				window.attachEvent("onload",S.load);
				var a=false;
				try
				{
					a=window.frameElement===null
				}
				catch(b)
				{}
				if(document.documentElement.doScroll&&a)
				{
					doScrollCheck()
				}
			}
		}
	}
	S.load=function()
	{
		if(loaded)
		{
			return
		}
		if(!document.body)
		{
			return setTimeout(S.load,13)
		}
		loaded=true;
		checkSupport();
		S.onReady();
		if(!S.options.skipSetup)
		{
			S.setup()
		}
		S.skin.init()
	};
	S.plugins={};
	if(navigator.plugins&&navigator.plugins.length)
	{
		var names=[];
		each(navigator.plugins,function(a,b)
		{
			names.push(b.name)
		});
		names=names.join(",");
		var f4m=names.indexOf("Flip4Mac")>-1;
		S.plugins=
		{
			fla:names.indexOf("Shockwave Flash")>-1,
			qt:names.indexOf("QuickTime")>-1,
			wmp:!f4m&&names.indexOf("Windows Media")>-1,
			f4m:f4m
		}
	}
	else
	{
		var detectPlugin=function(a)
		{
			var b;
			try
			{
				b=new ActiveXObject(a)
			}
			catch(c)
			{}
			return !!b
		};
		S.plugins=
		{
			fla:detectPlugin("ShockwaveFlash.ShockwaveFlash"),
			qt:detectPlugin("QuickTime.QuickTime"),
			wmp:detectPlugin("wmplayer.ocx"),
			f4m:false
		}
	};
	var relAttr=/^(light|shadow)box/i,expando="shadowboxCacheKey",cacheKey=1;
	S.cache={};
	S.select=function(b)
	{
		var c=[];
		if(!b)
		{
			var a;
			each(document.getElementsByTagName("a"),function(f,g)
			{
				a=g.getAttribute("rel");
				if(a&&relAttr.test(a))
				{
					c.push(g)
				}
			})
		}
		else
		{
			var e=b.length;
			if(e)
			{
				if(typeof b=="string")
				{
					if(S.find)
					{
						c=S.find(b)
					}
				}
				else
				{
					if(e==2&&typeof b[0]=="string"&&b[1].nodeType)
					{
						if(S.find)
						{
							c=S.find(b[0],b[1])
						}
					}
					else
					{
						for(var d=0;d<e;++d)
						{
							c[d]=b[d]
						}
					}
				}
			}
			else
			{
				c.push(b)
			}
		}
		return c
	};
	S.setup=function(a,b)
	{
		each(S.select(a),function(c,d)
		{
			S.addCache(d,b)
		})
	};
	S.teardown=function(a)
	{
		each(S.select(a),function(b,c)
		{
			S.removeCache(c)
		})
	};
	S.addCache=function(c,a)
	{
		var b=c[expando];
		if(b==undefined)
		{
			b=cacheKey++;
			c[expando]=b;
			addEvent(c,"click",handleClick)
		}
		S.cache[b]=S.makeObject(c,a)
	};
	S.removeCache=function(a)
	{
		removeEvent(a,"click",handleClick);
		delete S.cache[a[expando]];
		a[expando]=null
	};
	S.getCache=function(b)
	{
		var a=b[expando];
		return(a in S.cache&&S.cache[a])
	};
	S.clearCache=function()
	{
		for(var a in S.cache)
		{
			S.removeCache(S.cache[a].link)
		}
		S.cache={}
	};
	function handleClick(a)
	{
		S.open(this);
		if(S.gallery.length)
		{
			preventDefault(a)
		}
	};/*
 * SWFObject v2.1 <http://code.google.com/p/swfobject/>
 * Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
 * This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
 *
 * Modified for inclusion in Shadowbox.js
 */
	S.flash=(function()
	{
		var swfobject=function()
		{
			var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",FLASH_MIME_TYPE="application/x-shockwave-flash",EXPRESS_INSTALL_ID="SWFObjectExprInst",win=window,doc=document,nav=navigator,domLoadFnArr=[],regObjArr=[],objIdArr=[],listenersArr=[],script,timer=null,storedAltContent=null,storedAltContentId=null,isDomLoaded=false,isExpressInstallActive=false;
			var ua=function()
			{
				var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF,playerVersion=[0,0,0],d=null;
				if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT)
				{
					d=nav.plugins[SHOCKWAVE_FLASH].description;
					if(d&&!(typeof nav.mimeTypes!=UNDEF&&nav.mimeTypes[FLASH_MIME_TYPE]&&!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin))
					{
						d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");
						playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);
						playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);
						playerVersion[2]=/r/.test(d)?parseInt(d.replace(/^.*r(.*)$/,"$1"),10):0
					}
				}
				else
				{
					if(typeof win.ActiveXObject!=UNDEF)
					{
						var a=null,fp6Crash=false;
						try
						{
							a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".7")
						}
						catch(e)
						{
							try
							{
								a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".6");
								playerVersion=[6,0,21];
								a.AllowScriptAccess="always"
							}
							catch(e)
							{
								if(playerVersion[0]==6)
								{
									fp6Crash=true
								}
							}
							if(!fp6Crash)
							{
								try
								{
									a=new ActiveXObject(SHOCKWAVE_FLASH_AX)
								}
								catch(e)
								{
								}
							}
						}
						if(!fp6Crash&&a)
						{
							try
							{
								d=a.GetVariable("$version");
								if(d)
								{
									d=d.split(" ")[1].split(",");
									playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)]
								}
							}
							catch(e)
							{
							}
						}
					}
				}
				var u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=false,windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u);
				/*@cc_on
				ie = true;
				@if (@_win32)
					windows = true;
				@elif (@_mac)
					mac = true;
				@end
				@*/
				return{w3cdom:w3cdom,pv:playerVersion,webkit:webkit,ie:ie,win:windows,mac:mac}
			}();
			var onDomLoad=function()
			{
				if(!ua.w3cdom)
				{
					return
				}
				addDomLoadEvent(main);
				if(ua.ie&&ua.win)
				{
					try
					{
						doc.write("<script id=__ie_ondomload defer=true src=//:><\/script>");
						script=getElementById("__ie_ondomload");
						if(script)
						{
							addListener(script,"onreadystatechange",checkReadyState)
						}
					}
					catch(e)
					{
					}
				}
				if(ua.webkit&&typeof doc.readyState!=UNDEF)
				{
					timer=setInterval(function()
					{
						if(/loaded|complete/.test(doc.readyState))
						{
							callDomLoadFunctions()
						}
					},10)
				}
				if(typeof doc.addEventListener!=UNDEF)
				{
					doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,null)
				}
				addLoadEvent(callDomLoadFunctions)
			}();
			function checkReadyState()
			{
				if(script.readyState=="complete")
				{
					script.parentNode.removeChild(script);
					callDomLoadFunctions()
				}
			}
			function callDomLoadFunctions()
			{
				if(isDomLoaded)
				{
					return
				}
				if(ua.ie&&ua.win)
				{
					var s=createElement("span");
					try
					{
						var t=doc.getElementsByTagName("body")[0].appendChild(s);
						t.parentNode.removeChild(t)
					}
					catch(e)
					{
						return
					}
				}
				isDomLoaded=true;
				if(timer)
				{
					clearInterval(timer);
					timer=null
				}
				var dl=domLoadFnArr.length;
				for(var i=0;i<dl;i++)
				{
					domLoadFnArr[i]()
				}
			}
			function addDomLoadEvent(fn)
			{
				if(isDomLoaded)
				{
					fn()
				}
				else
				{
					domLoadFnArr[domLoadFnArr.length]=fn
				}
			}
			function addLoadEvent(fn)
			{
				if(typeof win.addEventListener!=UNDEF)
				{
					win.addEventListener("load",fn,false)
				}
				else
				{
					if(typeof doc.addEventListener!=UNDEF)
					{
						doc.addEventListener("load",fn,false)
					}
					else
					{
						if(typeof win.attachEvent!=UNDEF)
						{
							addListener(win,"onload",fn)
						}
						else
						{
							if(typeof win.onload=="function")
							{
								var fnOld=win.onload;
								win.onload=function()
								{
									fnOld();
									fn()
								}
							}
							else
							{
								win.onload=fn
							}
						}
					}
				}
			}
			function main()
			{
				var rl=regObjArr.length;
				for(var i=0;i<rl;i++)
				{
					var id=regObjArr[i].id;
					if(ua.pv[0]>0)
					{
						var obj=getElementById(id);
						if(obj)
						{
							regObjArr[i].width=obj.getAttribute("width")?obj.getAttribute("width"):"0";
							regObjArr[i].height=obj.getAttribute("height")?obj.getAttribute("height"):"0";
							if(hasPlayerVersion(regObjArr[i].swfVersion))
							{
								if(ua.webkit&&ua.webkit<312)
								{
									fixParams(obj)
								}
								setVisibility(id,true)
							}
							else
							{
								if(regObjArr[i].expressInstall&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac))
								{
									showExpressInstall(regObjArr[i])
								}
								else
								{
									displayAltContent(obj)
								}
							}
						}
					}
					else
					{
						setVisibility(id,true)
					}
				}
			}
			function fixParams(obj)
			{
				var nestedObj=obj.getElementsByTagName(OBJECT)[0];
				if(nestedObj)
				{
					var e=createElement("embed"),a=nestedObj.attributes;
					if(a)
					{
						var al=a.length;
						for(var i=0;i<al;i++)
						{
							if(a[i].nodeName=="DATA")
							{
								e.setAttribute("src",a[i].nodeValue)
							}
							else
							{
								e.setAttribute(a[i].nodeName,a[i].nodeValue)
							}
						}
					}
					var c=nestedObj.childNodes;
					if(c)
					{
						var cl=c.length;
						for(var j=0;j<cl;j++)
						{
							if(c[j].nodeType==1&&c[j].nodeName=="PARAM")
							{
								e.setAttribute(c[j].getAttribute("name"),c[j].getAttribute("value"))
							}
						}
					}
					obj.parentNode.replaceChild(e,obj)
				}
			}
			function showExpressInstall(regObj)
			{
				isExpressInstallActive=true;
				var obj=getElementById(regObj.id);
				if(obj)
				{
					if(regObj.altContentId)
					{
						var ac=getElementById(regObj.altContentId);
						if(ac)
						{
							storedAltContent=ac;
							storedAltContentId=regObj.altContentId
						}
					}
					else
					{
						storedAltContent=abstractAltContent(obj)
					}
					if(!(/%$/.test(regObj.width))&&parseInt(regObj.width,10)<310)
					{
						regObj.width="310"
					}
					if(!(/%$/.test(regObj.height))&&parseInt(regObj.height,10)<137)
					{
						regObj.height="137"
					}
					doc.title=doc.title.slice(0,47)+" - Flash Player Installation";
					var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",dt=doc.title,fv="MMredirectURL="+win.location+"&MMplayerType="+pt+"&MMdoctitle="+dt,replaceId=regObj.id;
					if(ua.ie&&ua.win&&obj.readyState!=4)
					{
						var newObj=createElement("div");
						replaceId+="SWFObjectNew";
						newObj.setAttribute("id",replaceId);
						obj.parentNode.insertBefore(newObj,obj);
						obj.style.display="none";
						var fn=function()
						{
							obj.parentNode.removeChild(obj)
						};
						addListener(win,"onload",fn)
					}
					createSWF(
					{
						data:regObj.expressInstall,id:EXPRESS_INSTALL_ID,width:regObj.width,height:regObj.height
					},
					{
						flashvars:fv
					},replaceId)
				}
			}
			function displayAltContent(obj)
			{
				if(ua.ie&&ua.win&&obj.readyState!=4)
				{
					var el=createElement("div");
					obj.parentNode.insertBefore(el,obj);
					el.parentNode.replaceChild(abstractAltContent(obj),el);
					obj.style.display="none";
					var fn=function()
					{
						obj.parentNode.removeChild(obj)
					};
					addListener(win,"onload",fn)
				}
				else
				{
					obj.parentNode.replaceChild(abstractAltContent(obj),obj)
				}
			}
			function abstractAltContent(obj)
			{
				var ac=createElement("div");
				if(ua.win&&ua.ie)
				{
					ac.innerHTML=obj.innerHTML
				}
				else
				{
					var nestedObj=obj.getElementsByTagName(OBJECT)[0];
					if(nestedObj)
					{
						var c=nestedObj.childNodes;
						if(c)
						{
							var cl=c.length;
							for(var i=0;i<cl;i++)
							{
								if(!(c[i].nodeType==1&&c[i].nodeName=="PARAM")&&!(c[i].nodeType==8))
								{
									ac.appendChild(c[i].cloneNode(true))
								}
							}
						}
					}
				}
				return ac
			}
			function createSWF(attObj,parObj,id)
			{
				var r,el=getElementById(id);
				if(el)
				{
					if(typeof attObj.id==UNDEF)
					{
						attObj.id=id
					}
					if(ua.ie&&ua.win)
					{
						var att="";
						for(var i in attObj)
						{
							if(attObj[i]!=Object.prototype[i])
							{
								if(i.toLowerCase()=="data")
								{
									parObj.movie=attObj[i]
								}
								else
								{
									if(i.toLowerCase()=="styleclass")
									{
										att+=' class="'+attObj[i]+'"'
									}
									else
									{
										if(i.toLowerCase()!="classid")
										{
											att+=" "+i+'="'+attObj[i]+'"'
										}
									}
								}
							}
						}
						var par="";
						for(var j in parObj)
						{
							if(parObj[j]!=Object.prototype[j])
							{
								par+='<param name="'+j+'" value="'+parObj[j]+'" />'
							}
						}
						el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+">"+par+"</object>";
						objIdArr[objIdArr.length]=attObj.id;
						r=getElementById(attObj.id)
					}
					else
					{
						if(ua.webkit&&ua.webkit<312)
						{
							var e=createElement("embed");
							e.setAttribute("type",FLASH_MIME_TYPE);
							for(var k in attObj)
							{
								if(attObj[k]!=Object.prototype[k])
								{
									if(k.toLowerCase()=="data")
									{
										e.setAttribute("src",attObj[k])
									}
									else
									{
										if(k.toLowerCase()=="styleclass")
										{
											e.setAttribute("class",attObj[k])
										}
										else
										{
											if(k.toLowerCase()!="classid")
											{
												e.setAttribute(k,attObj[k])
											}
										}
									}
								}
							}
							for(var l in parObj)
							{
								if(parObj[l]!=Object.prototype[l])
								{
									if(l.toLowerCase()!="movie")
									{
										e.setAttribute(l,parObj[l])
									}
								}
							}
							el.parentNode.replaceChild(e,el);
							r=e
						}
						else
						{
							var o=createElement(OBJECT);
							o.setAttribute("type",FLASH_MIME_TYPE);
							for(var m in attObj)
							{
								if(attObj[m]!=Object.prototype[m])
								{
									if(m.toLowerCase()=="styleclass")
									{
										o.setAttribute("class",attObj[m])
									}
									else
									{
										if(m.toLowerCase()!="classid")
										{
											o.setAttribute(m,attObj[m])
										}
									}
								}
							}
							for(var n in parObj)
							{
								if(parObj[n]!=Object.prototype[n]&&n.toLowerCase()!="movie")
								{
									createObjParam(o,n,parObj[n])
								}
							}
							el.parentNode.replaceChild(o,el);
							r=o
						}
					}
				}
				return r
			}
			function createObjParam(el,pName,pValue)
			{
				var p=createElement("param");
				p.setAttribute("name",pName);
				p.setAttribute("value",pValue);
				el.appendChild(p)
			}
			function removeSWF(id)
			{
				var obj=getElementById(id);
				if(obj&&(obj.nodeName=="OBJECT"||obj.nodeName=="EMBED"))
				{
					if(ua.ie&&ua.win)
					{
						if(obj.readyState==4)
						{
							removeObjectInIE(id)
						}
						else
						{
							win.attachEvent("onload",function()
							{
								removeObjectInIE(id)
							})
						}
					}
					else
					{
						obj.parentNode.removeChild(obj)
					}
				}
			}
			function removeObjectInIE(id)
			{
				var obj=getElementById(id);
				if(obj)
				{
					for(var i in obj)
					{
						if(typeof obj[i]=="function")
						{
							obj[i]=null
						}
					}
					obj.parentNode.removeChild(obj)
				}
			}
			function getElementById(id)
			{
				var el=null;
				try
				{
					el=doc.getElementById(id)
				}
				catch(e)
				{
				}
				return el
			}
			function createElement(el)
			{
				return doc.createElement(el)
			}
			function addListener(target,eventType,fn)
			{
				target.attachEvent(eventType,fn);
				listenersArr[listenersArr.length]=[target,eventType,fn]
			}
			function hasPlayerVersion(rv)
			{
				var pv=ua.pv,v=rv.split(".");
				v[0]=parseInt(v[0],10);
				v[1]=parseInt(v[1],10)||0;
				v[2]=parseInt(v[2],10)||0;
				return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false
			}
			function createCSS(sel,decl)
			{
				if(ua.ie&&ua.mac)
				{
					return
				}
				var h=doc.getElementsByTagName("head")[0],s=createElement("style");
				s.setAttribute("type","text/css");
				s.setAttribute("media","screen");
				if(!(ua.ie&&ua.win)&&typeof doc.createTextNode!=UNDEF)
				{
					s.appendChild(doc.createTextNode(sel+" {"+decl+"}"))
				}
				h.appendChild(s);
				if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0)
				{
					var ls=doc.styleSheets[doc.styleSheets.length-1];
					if(typeof ls.addRule==OBJECT)
					{
						ls.addRule(sel,decl)
					}
				}
			}
			function setVisibility(id,isVisible)
			{
				var v=isVisible?"visible":"hidden";
				if(isDomLoaded&&getElementById(id))
				{
					getElementById(id).style.visibility=v
				}
				else
				{
					createCSS("#"+id,"visibility:"+v)
				}
			}
			function urlEncodeIfNecessary(s)
			{
				var regex=/[\\\"<>\.;]/;
				var hasBadChars=regex.exec(s)!=null;
				return hasBadChars?encodeURIComponent(s):s
			}
			var cleanup=function()
			{
				if(ua.ie&&ua.win)
				{
					window.attachEvent("onunload",function()
					{
						var ll=listenersArr.length;
						for(var i=0;i<ll;i++)
						{
							listenersArr[i][0].detachEvent(listenersArr[i][1],listenersArr[i][2])
						}
						var il=objIdArr.length;
						for(var j=0;j<il;j++)
						{
							removeSWF(objIdArr[j])
						}
						for(var k in ua)
						{
							ua[k]=null
						}
						ua=null;
						for(var l in swfobject)
						{
							swfobject[l]=null
						}
						swfobject=null
					})
				}
			}();
			return{
				registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr)
				{
					if(!ua.w3cdom||!objectIdStr||!swfVersionStr)
					{
						return
					}
					var regObj={};
					regObj.id=objectIdStr;
					regObj.swfVersion=swfVersionStr;
					regObj.expressInstall=xiSwfUrlStr?xiSwfUrlStr:false;
					regObjArr[regObjArr.length]=regObj;
					setVisibility(objectIdStr,false)
				},getObjectById:function(objectIdStr)
				{
					var r=null;
					if(ua.w3cdom)
					{
						var o=getElementById(objectIdStr);
						if(o)
						{
							var n=o.getElementsByTagName(OBJECT)[0];
							if(!n||(n&&typeof o.SetVariable!=UNDEF))
							{
								r=o
							}
							else
							{
								if(typeof n.SetVariable!=UNDEF)
								{
									r=n
								}
							}
						}
					}
					return r
				},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj)
				{
					if(!ua.w3cdom||!swfUrlStr||!replaceElemIdStr||!widthStr||!heightStr||!swfVersionStr)
					{
						return
					}
					widthStr+="";
					heightStr+="";
					if(hasPlayerVersion(swfVersionStr))
					{
						setVisibility(replaceElemIdStr,false);
						var att={};
						if(attObj&&typeof attObj===OBJECT)
						{
							for(var i in attObj)
							{
								if(attObj[i]!=Object.prototype[i])
								{
									att[i]=attObj[i]
								}
							}
						}
						att.data=swfUrlStr;
						att.width=widthStr;
						att.height=heightStr;
						var par={};
						if(parObj&&typeof parObj===OBJECT)
						{
							for(var j in parObj)
							{
								if(parObj[j]!=Object.prototype[j])
								{
									par[j]=parObj[j]
								}
							}
						}
						if(flashvarsObj&&typeof flashvarsObj===OBJECT)
						{
							for(var k in flashvarsObj)
							{
								if(flashvarsObj[k]!=Object.prototype[k])
								{
									if(typeof par.flashvars!=UNDEF)
									{
										par.flashvars+="&"+k+"="+flashvarsObj[k]
									}
									else
									{
										par.flashvars=k+"="+flashvarsObj[k]
									}
								}
							}
						}
						addDomLoadEvent(function()
						{
							createSWF(att,par,replaceElemIdStr);
							if(att.id==replaceElemIdStr)
							{
								setVisibility(replaceElemIdStr,true)
							}
						})
					}
					else
					{
						if(xiSwfUrlStr&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac))
						{
							isExpressInstallActive=true;
							setVisibility(replaceElemIdStr,false);
							addDomLoadEvent(function()
							{
								var regObj={};
								regObj.id=regObj.altContentId=replaceElemIdStr;
								regObj.width=widthStr;
								regObj.height=heightStr;
								regObj.expressInstall=xiSwfUrlStr;
								showExpressInstall(regObj)
							})
						}
					}
				},getFlashPlayerVersion:function()
				{
					return{
						major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]
					}
				},hasFlashPlayerVersion:hasPlayerVersion,createSWF:function(attObj,parObj,replaceElemIdStr)
				{
					if(ua.w3cdom)
					{
						return createSWF(attObj,parObj,replaceElemIdStr)
					}
					else
					{
						return undefined
					}
				},removeSWF:function(objElemIdStr)
				{
					if(ua.w3cdom)
					{
						removeSWF(objElemIdStr)
					}
				},createCSS:function(sel,decl)
				{
					if(ua.w3cdom)
					{
						createCSS(sel,decl)
					}
				},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,getQueryParamValue:function(param)
				{
					var q=doc.location.search||doc.location.hash;
					if(param==null)
					{
						return urlEncodeIfNecessary(q)
					}
					if(q)
					{
						var pairs=q.substring(1).split("&");
						for(var i=0;i<pairs.length;i++)
						{
							if(pairs[i].substring(0,pairs[i].indexOf("="))==param)
							{
								return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=")+1)))
							}
						}
					}
					return""
				},expressInstallCallback:function()
				{
					if(isExpressInstallActive&&storedAltContent)
					{
						var obj=getElementById(EXPRESS_INSTALL_ID);
						if(obj)
						{
							obj.parentNode.replaceChild(storedAltContent,obj);
							if(storedAltContentId)
							{
								setVisibility(storedAltContentId,true);
								if(ua.ie&&ua.win)
								{
									storedAltContent.style.display="block"
								}
							}
							storedAltContent=null;
							storedAltContentId=null;
							isExpressInstallActive=false
						}
					}
				}
			}
		}();
		return swfobject
	})();
	S.lang=
	{
		code:"en",of:"of",loading:"loading",cancel:"Cancel",next:"Next",previous:"Previous",play:"Play",pause:"Pause",close:"Close",errors:{single:'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',shared:'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',either:'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'
	}
};
S.html=function(a,b)
{
	this.obj=a;
	this.id=b;
	this.height=a.height?parseInt(a.height,10):300;
	this.width=a.width?parseInt(a.width,10):500};
	S.html.prototype={append:function(a,b)
	{
		var c=document.createElement("div");
		c.id=this.id;
		c.className="html";
		c.innerHTML=this.obj.content;
		a.appendChild(c)
	},remove:function()
	{
		var a=get(this.id);
		if(a)
		{
			remove(a)
		}
	}
};
S.iframe=function(b,c)
{
	this.obj=b;
	this.id=c;
	var a=get("sb-overlay");
	this.height=b.height?parseInt(b.height,10):a.offsetHeight;
	this.width=b.width?parseInt(b.width,10):a.offsetWidth
};
S.iframe.prototype=
{
	append:function(a,c)
	{
		var b='<iframe id="'+this.id+'" name="'+this.id+'" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" style="visibility:hidden" onload="this.style.visibility=\'visible\'" scrolling="auto"';
		if(S.isIE)
		{
			b+=' allowtransparency="true"';
			if(S.isIE6)
			{
				b+=" src=\"javascript:false;document.write('');\""
			}
		}
		b+="></iframe>";
		a.innerHTML=b
	},remove:function()
	{
		var a=get(this.id);
		if(a)
		{
			remove(a);
			if(S.isGecko)
			{
				delete window.frames[this.id]
			}
		}
	},onLoad:function()
	{
		var a=S.isIE?get(this.id).contentWindow:window.frames[this.id];
		a.location.href=this.obj.content
	}
};
var pre,proxyId="sb-drag-proxy",dragData,dragProxy,dragTarget;
function resetDrag()
{
	dragData={x:0,y:0,startX:null,startY:null}
}
function updateProxy()
{
	var a=S.dimensions;
	apply(dragProxy.style,{height:a.innerHeight+"px",width:a.innerWidth+"px"})
}
function enableDrag()
{
	resetDrag();
	var a=["position:absolute","cursor:"+(S.isGecko?"-moz-grab":"move"),"background-color:"+(S.isIE?"#fff;filter:alpha(opacity=0)":"transparent")].join(";");
	S.appendHTML(S.skin.body,'<div id="'+proxyId+'" style="'+a+'"></div>');
	dragProxy=get(proxyId);
	updateProxy();
	addEvent(dragProxy,"mousedown",startDrag)
}
function disableDrag()
{
	if(dragProxy)
	{
		removeEvent(dragProxy,"mousedown",startDrag);
		remove(dragProxy);
		dragProxy=null
	}
	dragTarget=null
}
function startDrag(b)
{
	preventDefault(b);
	var a=getPageXY(b);
	dragData.startX=a[0];
	dragData.startY=a[1];
	dragTarget=get(S.player.id);
	addEvent(document,"mousemove",positionDrag);
	addEvent(document,"mouseup",endDrag);
	if(S.isGecko)
	{
		dragProxy.style.cursor="-moz-grabbing"
	}
}
function positionDrag(f)
{
	var a=S.player,g=S.dimensions,d=getPageXY(f);
	var c=d[0]-dragData.startX;
	dragData.startX+=c;
	dragData.x=Math.max(Math.min(0,dragData.x+c),g.innerWidth-a.width);
	var b=d[1]-dragData.startY;
	dragData.startY+=b;
	dragData.y=Math.max(Math.min(0,dragData.y+b),g.innerHeight-a.height);
	apply(dragTarget.style,{left:dragData.x+"px",top:dragData.y+"px"})
}
function endDrag()
{
	removeEvent(document,"mousemove",positionDrag);
	removeEvent(document,"mouseup",endDrag);
	if(S.isGecko)
	{
		dragProxy.style.cursor="-moz-grab"
	}
}
S.img=function(b,c)
{
	this.obj=b;
	this.id=c;
	this.ready=false;
	var a=this;
	pre=new Image();
	pre.onload=function()
	{
		a.height=b.height?parseInt(b.height,10):pre.height;
		a.width=b.width?parseInt(b.width,10):pre.width;
		a.ready=true;
		pre.onload=null;
		pre=null};
		pre.src=b.content
	};
	S.img.ext=["bmp","gif","jpg","jpeg","png"];
	S.img.prototype=
	{
		append:function(b,e)
		{
			var c=document.createElement("img");
			c.id=this.id;
			c.src=this.obj.content;
			c.style.position="absolute";
			var a,d;
			if(e.oversized&&S.options.handleOversize=="resize")
			{
				a=e.innerHeight;
				d=e.innerWidth
			}
			else
			{
				a=this.height;
				d=this.width
			}
			c.setAttribute("height",a);
			c.setAttribute("width",d);
			b.appendChild(c)
		},remove:function()
		{
			var a=get(this.id);
			if(a)
			{
				remove(a)
			}
			disableDrag();
			if(pre)
			{
				pre.onload=null;
				pre=null
			}
		},onLoad:function()
		{
			var a=S.dimensions;
			if(a.oversized&&S.options.handleOversize=="drag")
			{
				enableDrag()
			}
		},onWindowResize:function()
		{
			var d=S.dimensions;
			switch(S.options.handleOversize)
			{
				case"resize":
					var a=get(this.id);
					a.height=d.innerHeight;
					a.width=d.innerWidth;
					break;
				case"drag":
					if(dragTarget)
					{
						var c=parseInt(S.getStyle(dragTarget,"top")),b=parseInt(S.getStyle(dragTarget,"left"));
						if(c+this.height<d.innerHeight)
						{
							dragTarget.style.top=d.innerHeight-this.height+"px"
						}
						if(b+this.width<d.innerWidth)
						{
							dragTarget.style.left=d.innerWidth-this.width+"px"
						}
						updateProxy()
					}
					break
			}
		}
	};
	var qtControllerHeight=16;
	S.qt=function(a,b)
	{
		this.obj=a;
		this.id=b;
		this.height=a.height?parseInt(a.height,10):300;
		if(S.options.showMovieControls)
		{
			this.height+=qtControllerHeight
		}
		this.width=a.width?parseInt(a.width,10):300};
		S.qt.ext=["dv","mov","moov","movie","mp4","avi","mpg","mpeg"];
		S.qt.prototype={append:function(h,i)
		{
			var b=S.options,c=String(b.autoplayMovies),j=String(b.showMovieControls);
			var g="<object",e={id:this.id,name:this.id,height:this.height,width:this.width,kioskmode:"true"
		};
		if(S.isIE)
		{
			e.classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
			e.codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"
		}
		else
		{
			e.type="video/quicktime";
			e.data=this.obj.content
		}
		for(var d in e)
		{
			g+=" "+d+'="'+e[d]+'"'
		}
		g+=">";
		var f={src:this.obj.content,scale:"aspect",controller:j,autoplay:c};
		for(var a in f)
		{
			g+='<param name="'+a+'" value="'+f[a]+'">'
		}
		g+="</object>";
		h.innerHTML=g
	},remove:function()
	{
		try
		{
			document[this.id].Stop()
		}
		catch(b)
		{
		}
		var a=get(this.id);
		if(a)
		{
			remove(a)
		}
	}
};
S.swf=function(a,b)
{
	this.obj=a;
	this.id=b;
	this.height=a.height?parseInt(a.height,10):300;
	this.width=a.width?parseInt(a.width,10):300
};
S.swf.ext=["swf"];
S.swf.prototype=
{
	append:function(g,i)
	{
		var f=document.createElement("div");
		f.id=this.id;
		g.appendChild(f);
		var j=i.innerHeight,b=i.innerWidth,c=this.obj.content,h=S.options.flashVersion,a=S.path+"expressInstall.swf",d=S.options.flashVars,e=S.options.flashParams;
		S.flash.embedSWF(c,this.id,b,j,h,a,d,e)
	},remove:function()
	{
		S.flash.expressInstallCallback();
		S.flash.removeSWF(this.id)
	},onWindowResize:function()
	{
		var b=S.dimensions,a=get(this.id);
		a.height=b.innerHeight;
		a.width=b.innerWidth
	}
};
var wmpControllerHeight=(S.isIE?70:45);
S.wmp=function(a,b)
{
	this.obj=a;
	this.id=b;
	this.height=a.height?parseInt(a.height,10):300;
	if(S.options.showMovieControls)
	{
		this.height+=wmpControllerHeight
	}
	this.width=a.width?parseInt(a.width,10):300
};
S.wmp.ext=["asf","avi","mpg","mpeg","wm","wmv"];
S.wmp.prototype=
{
	append:function(a,g)
	{
		var c=S.options,d=c.autoplayMovies?1:0;
		var b='<object id="'+this.id+'" name="'+this.id+'" height="'+this.height+'" width="'+this.width+'"',f={autostart:c.autoplayMovies?1:0};
		if(S.isIE)
		{
			b+=' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"';
			f.url=this.obj.content;
			f.uimode=c.showMovieControls?"full":"none"
		}
		else
		{
			b+=' type="video/x-ms-wmv"';
			b+=' data="'+this.obj.content+'"';
			f.showcontrols=c.showMovieControls?1:0
		}
		b+=">";
		for(var e in f)
		{
			b+='<param name="'+e+'" value="'+f[e]+'">'
		}
		b+="</object>";
		a.innerHTML=b
	},remove:function()
	{
		if(S.isIE)
		{
			try
			{
				window[this.id].controls.stop();
				window[this.id].URL="movie"+now()+".wmv";
				window[this.id]=function()
				{
				}
			}
			catch(b)
			{
			}
		}
		var a=get(this.id);
		if(a)
		{
			setTimeout(function()
			{
				remove(a)
			},10)
		}
	}
};
var overlayOn=false,visibilityCache=[],pngIds=["sb-nav-close","sb-nav-next","sb-nav-play","sb-nav-pause","sb-nav-previous"],container,overlay,wrapper,doWindowResize=true;
function animate(c,m,j,h,n)
{
	var a=(m=="opacity"),i=a?S.setOpacity:function(o,p)
	{
		o.style[m]=""+p+"px"
	};
	if(h==0||(!a&&!S.options.animate)||(a&&!S.options.animateFade))
	{
		i(c,j);
		if(n)
		{
			n()
		}
		return
	}
	var k=parseFloat(S.getStyle(c,m))||0;
	var l=j-k;
	if(l==0)
	{
		if(n)
		{
			n()
		}
		return
	}
	h*=1000;
	var d=now(),g=S.ease,f=d+h,e;
	var b=setInterval(function()
	{
		e=now();
		if(e>=f)
		{
			clearInterval(b);
			b=null;
			i(c,j);
			if(n)
			{
				n()
			}
		}
		else
		{
			i(c,k+g((e-d)/h)*l)
		}
	},10)
}
function setSize()
{
	container.style.height=S.getWindowSize("Height")+"px";
	container.style.width=S.getWindowSize("Width")+"px"
}
function setPosition()
{
	container.style.top=document.documentElement.scrollTop+"px";
	container.style.left=document.documentElement.scrollLeft+"px"
}
function toggleTroubleElements(a)
{
	if(a)
	{
		each(visibilityCache,function(b,c)
		{
			c[0].style.visibility=c[1]||""
		})
	}
	else
	{
		visibilityCache=[];
		each(S.options.troubleElements,function(c,b)
		{
			each(document.getElementsByTagName(b),function(d,e)
			{
				visibilityCache.push([e,e.style.visibility]);
				e.style.visibility="hidden"
			})
		})
	}
}
function toggleNav(c,a)
{
	var b=get("sb-nav-"+c);
	if(b)
	{
		b.style.display=a?"":"none"
	}
}
function toggleLoading(a,f)
{
	var e=get("sb-loading"),c=S.getCurrent().player,d=(c=="img"||c=="html");
	if(a)
	{
		S.setOpacity(e,0);
		e.style.display="block";
		var b=function()
		{
			S.clearOpacity(e);
			if(f)
			{
				f()
			}
		};
		if(d)
		{
			animate(e,"opacity",1,S.options.fadeDuration,b)
		}
		else
		{
			b()
		}
	}
	else
	{
		var b=function()
		{
			e.style.display="none";
			S.clearOpacity(e);
			if(f)
			{
				f()
			}
		};
		if(d)
		{
			animate(e,"opacity",0,S.options.fadeDuration,b)
		}
		else
		{
			b()
		}
	}
}
function buildBars(m)
{
	var f=S.getCurrent();
	get("sb-title-inner").innerHTML=f.title||"";
	var n,j,b,o,k;
	if(S.options.displayNav)
	{
		n=true;
		var l=S.gallery.length;
		if(l>1)
		{
			if(S.options.continuous)
			{
				j=k=true
			}
			else
			{
				j=(l-1)>S.current;
				k=S.current>0
			}
		}
		if(S.options.slideshowDelay>0&&S.hasNext())
		{
			o=!S.isPaused();
			b=!o
		}
	}
	else
	{
		n=j=b=o=k=false
	}
	toggleNav("close",n);
	toggleNav("next",j);
	toggleNav("play",b);
	toggleNav("pause",o);
	toggleNav("previous",k);
	var a="";
	if(S.options.displayCounter&&S.gallery.length>1)
	{
		var l=S.gallery.length;
		if(S.options.counterType=="skip")
		{
			var e=0,d=l,c=parseInt(S.options.counterLimit)||0;
			if(c<l&&c>2)
			{
				var g=Math.floor(c/2);
				e=S.current-g;
				if(e<0)
				{
					e+=l
				}
				d=S.current+(c-g);
				if(d>l)
				{
					d-=l
				}
			}
			while(e!=d)
			{
				if(e==l)
				{
					e=0
				}
				a+='<a onclick="Shadowbox.change('+e+');"';
				if(e==S.current)
				{
					a+=' class="sb-counter-current"'
				}
				a+=">"+(++e)+"</a>"
			}
		}
		else
		{
			a=[S.current+1,S.lang.of,l].join(" ")
		}
	}
	get("sb-counter").innerHTML=a;m()
}
function showBars(d)
{
	var a=get("sb-title-inner"),c=get("sb-info-inner"),b=0.35;
	a.style.visibility=c.style.visibility="";
	if(a.innerHTML!="")
	{
		animate(a,"marginTop",0,b)
	}
	animate(c,"marginTop",0,b,d)
}
function hideBars(c,i)
{
	var g=get("sb-title"),a=get("sb-info"),d=g.offsetHeight,e=a.offsetHeight,f=get("sb-title-inner"),h=get("sb-info-inner"),b=(c?0.35:0);
	animate(f,"marginTop",d,b);
	animate(h,"marginTop",e*-1,b,function()
	{
		f.style.visibility=h.style.visibility="hidden";
		i()
	})
}
function adjustHeight(a,d,b,f)
{
	var e=get("sb-wrapper-inner"),c=(b?S.options.resizeDuration:0);
	animate(wrapper,"top",d,c);
	animate(e,"height",a,c,f)
}
function adjustWidth(a,d,b,e)
{
	var c=(b?S.options.resizeDuration:0);
	animate(wrapper,"left",d,c);
	animate(wrapper,"width",a,c,e)
}
function setDimensions(i,c)
{
	var e=get("sb-body-inner"),i=parseInt(i),c=parseInt(c),b=wrapper.offsetHeight-e.offsetHeight,a=wrapper.offsetWidth-e.offsetWidth,g=overlay.offsetHeight,h=overlay.offsetWidth,f=parseInt(S.options.viewportPadding)||20,d=(S.player&&S.options.handleOversize!="drag");
	return S.setDimensions(i,c,g,h,b,a,f,d)
}
var K={};
K.markup='<div id="sb-container"><div id="sb-overlay"></div><div id="sb-wrapper"><div id="sb-title"><div id="sb-title-inner"></div></div><div id="sb-wrapper-inner"><div id="sb-body"><div id="sb-body-inner"></div><div id="sb-loading"><div id="sb-loading-inner"><span>{loading}</span></div></div></div></div><div id="sb-info"><div id="sb-info-inner"><div id="sb-counter"></div><div id="sb-nav"><a id="sb-nav-close" title="{close}" onclick="Shadowbox.close()"></a><a id="sb-nav-next" title="{next}" onclick="Shadowbox.next()"></a><a id="sb-nav-play" title="{play}" onclick="Shadowbox.play()"></a><a id="sb-nav-pause" title="{pause}" onclick="Shadowbox.pause()"></a><a id="sb-nav-previous" title="{previous}" onclick="Shadowbox.previous()"></a></div></div></div></div></div>';
K.options=
{
	animSequence:"sync",counterLimit:10,counterType:"default",displayCounter:true,displayNav:true,fadeDuration:0.35,initialHeight:160,initialWidth:320,modal:false,overlayColor:"#000",overlayOpacity:0.5,resizeDuration:0.35,showOverlay:true,troubleElements:["select","object","embed","canvas"]
};
K.init=function()
{
	S.appendHTML(document.body,sprintf(K.markup,S.lang));
	K.body=get("sb-body-inner");
	container=get("sb-container");
	overlay=get("sb-overlay");
	wrapper=get("sb-wrapper");
	if(!supportsFixed)
	{
		container.style.position="absolute"
	}
	if(!supportsOpacity)
	{
		var c,a,b=/url\("(.*\.png)"\)/;
		each(pngIds,function(e,f)
		{
			c=get(f);
			if(c)
			{
				a=S.getStyle(c,"backgroundImage").match(b);
				if(a)
				{
					c.style.backgroundImage="none";
					c.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src="+a[1]+",sizingMethod=scale);"
				}
			}
		}
	)
}
var d;
addEvent(window,"resize",function()
{
	if(d)
	{
		clearTimeout(d);
		d=null
	}
	if(open)
	{
		d=setTimeout(K.onWindowResize,10)
	}
})
};
K.onOpen=function(a,c)
{
	doWindowResize=false;
	container.style.display="block";
	setSize();
	var b=setDimensions(S.options.initialHeight,S.options.initialWidth);
	adjustHeight(b.innerHeight,b.top);
	adjustWidth(b.width,b.left);
	if(S.options.showOverlay)
	{
		overlay.style.backgroundColor=S.options.overlayColor;
		S.setOpacity(overlay,0);
		if(!S.options.modal)
		{
			addEvent(overlay,"click",S.close)
		}
		overlayOn=true
	}
	if(!supportsFixed)
	{
		setPosition();
		addEvent(window,"scroll",setPosition)
	}
	toggleTroubleElements();
	container.style.visibility="visible";
	if(overlayOn)
	{
		animate(overlay,"opacity",S.options.overlayOpacity,S.options.fadeDuration,c)
	}
	else
	{
		c()
	}
};
K.onLoad=function(b,a)
{
	toggleLoading(true);
	while(K.body.firstChild)
	{
		remove(K.body.firstChild)
	}
	hideBars(b,function()
	{
		if(!open)
		{
			return
		}
		if(!b)
		{
			wrapper.style.visibility="visible"
		}
		buildBars(a)
	})
};
K.onReady=function(d)
{
	if(!open)
	{
		return
	}
	var b=S.player,c=setDimensions(b.height,b.width);
	var a=function()
	{
		showBars(d)
	};
	switch(S.options.animSequence)
	{
		case"hw":
			adjustHeight(c.innerHeight,c.top,true,function()
			{
				adjustWidth(c.width,c.left,true,a)
			});
			break;
		case"wh":
			adjustWidth(c.width,c.left,true,function()
			{
				adjustHeight(c.innerHeight,c.top,true,a)
			});
			break;
		default:
			adjustWidth(c.width,c.left,true);
			adjustHeight(c.innerHeight,c.top,true,a)
	}
};
K.onShow=function(a)
{
	toggleLoading(false,a);
	doWindowResize=true
};
K.onClose=function()
{
	if(!supportsFixed)
	{
		removeEvent(window,"scroll",setPosition)
	}
	removeEvent(overlay,"click",S.close);
	wrapper.style.visibility="hidden";
	var a=function()
	{
		container.style.visibility="hidden";
		container.style.display="none";
		toggleTroubleElements(true)
	};
	if(overlayOn)
	{
		animate(overlay,"opacity",0,S.options.fadeDuration,a)
	}
	else
	{
		a()
	}
};
K.onPlay=function()
{
	toggleNav("play",false);
	toggleNav("pause",true)};
	K.onPause=function()
	{
		toggleNav("pause",false);
		toggleNav("play",true)
	};
	K.onWindowResize=function()
	{
		if(!doWindowResize)
		{
			return
		}
		setSize();
		var a=S.player,b=setDimensions(a.height,a.width);
		adjustWidth(b.width,b.left);
		adjustHeight(b.innerHeight,b.top);
		if(a.onWindowResize)
		{
			a.onWindowResize()
		}
	};
	S.skin=K;// expose
		
	window['Shadowbox'] = S;

})(window);
